package com.example.mapp.buildSql;

import com.example.ext.entity.ExtRescueDrill;
import org.apache.ibatis.jdbc.SQL;

public class RescueDrillMappSql {

    public String queryList(ExtRescueDrill extRescueDrill) {
        String select = " a.* ";
        String table = " rescue_drill a ";
        String whereParam = "";
        if (null != extRescueDrill.getDrillPartyId()){
            whereParam += " and a.drill_party_id = #{drillPartyId}";
        }
        if (null != extRescueDrill.getMaintenancePartyId()) {
            whereParam += " and a.maintenance_party_id = #{maintenancePartyId}";
        }
        String where = " 1=1 " + whereParam;
        return new SQL() {
            {
                SELECT(select);
                FROM(table);
                WHERE(where);
            }
        }.toString();
    }
}
